<?php
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magento Enterprise Edition End User License Agreement
 * that is bundled with this package in the file LICENSE_EE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.magento.com/license/enterprise-edition
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     enterprise_default
 * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license http://www.magento.com/license/enterprise-edition
 */
/** @var $this Enterprise_Rma_Block_Return_Tracking */
?>

<?php if ($this->getErrorMessage()): ?>
<tr>
    <td colspan="3">
        <ul class="messages">
             <li class="error-msg"><?php echo $this->escapeHtml($this->getErrorMessage()) ?></li>
        </ul>
    </td>
</tr>
<?php endif ?>
<?php foreach ($this->getTrackingNumbers() as $number): ?>
<tr>
    <td><?php echo $this->escapeHtml($number->getCarrierTitle()) ?></td>
    <td>
        <a
            href="#"
            onclick="popWin('<?php echo $this->helper('enterprise_rma')->getTrackingPopupUrlBySalesModel($number) ?>','trackshipment','width=800,height=600,top=0,left=0,resizable=yes,scrollbars=yes'); return false;"
            title="<?php echo $this->escapeHtml($number->getTrackNumber()) ?>">
                <?php echo $this->escapeHtml($number->getTrackNumber()) ?>
        </a>
    </td>
    <td>
        <?php if(!$number->getIsAdmin() && $this->isPrintShippingLabelAllowed()): ?>
            <a href="javascript://" onclick="deleteTrackNumber(<?php echo $number->getEntityId()?>)">
                <?php echo $this->__('Delete') ?>
            </a>
        <?php endif ?>
    </td>
</tr>
<?php endforeach; ?>
<?php if ($this->isPrintShippingLabelAllowed()): ?>
<script type="text/javascript">
//<![CDATA[
    function deleteTrackNumber(number) {
        if (confirm("<?php echo Mage::helper('core')->jsQuoteEscape($this->__('Are you sure you want to delete this tracking information?')) ?>")){
            new Ajax.Updater('track-info-tbody', '<?php echo $this->getDeleteLabelUrl() ?>', {
                onCreate: function() { $('rma-please-wait').show() },
                onComplete: function() {
                    $('rma-please-wait').hide();
                    decorateTable('track-info-table');
                },
                parameters: {number: number}
            });
        }
        return false;
    }
//]]>
</script>
<?php endif; ?>
